home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Softdisk Supreme
/
Softdisk Supreme.iso
/
pc
/
DSK Files
/
0-49
/
SD014b.dsk
/
A-MAZE-ING.bas
next >
Wrap
BASIC Source File
|
2003-06-12
|
5KB
|
123 lines
10 REM MAZE GAME
15 REM CONTRIBUTED TO PUBLIC DOMAIN BY DAVE GARSON
20 REM INITIALIZING
30 TEXT : HOME : SPEED= 255
40 REM TITLE
50 VTAB 11: HTAB 13
60 PRINT "A - MAZE - ING"
70 FOR PAUSE = 1 TO 2500: NEXT : HOME
74 TIME = 0
75 WIN = 0:BUMPS = 0:SCRE = 0
80 TALLY = 1: REM INITIALIZE FOR SCOREKEEPING
90 TEXT
100 HOME : VTAB 6: PRINT "DO YOU WISH TO GUARANTEE THE MAZE HAS A SOLUTION? (THIS MAY MAKE THE MAZE MORE OBVIOUS): ";: INPUT "";GUARANTEE$
110 IF LEFT$(GUARANTEE$,1) = "Y" THEN GUARANTEE = 1
120 PRINT : PRINT : PRINT
130 PRINT "DO YOU WISH TO SEE THE MAZE BEING DRAWN? (THIS, TOO, MAKES THE GAME EASIER): ";
134 INPUT "";SEE$
140 IF LEFT$(SEE$,1) = "N" THEN SEE = 1
200 GOTO 2000: REM DRAW MAZE
300 GOTO 3000: REM THE ACTUAL GAME
900 END
2000 REM DRAW MAZE
2005 GR
2010 IF SEE THEN POKE -16299,0: POKE -16302,0: REM STARE AT PAGE 2
2020 COLOR= 13: REM YELLOW
2040 REM DRAW RANDOM MAZE ON 40 BY 40 LORES SCREEN (40 TIMES 40 IS 1600, SO WE'LLCOLOR IN ABOUT 600 SPOTS)
2050 FOR SPOT = 1 TO 700
2060 X = INT( RND(1) *40): REM RANDOM NUMBER FROM 0 TO 39
2070 Y = INT( RND(1) *40)
2080 IF X <6 AND Y <6 OR X >33 AND Y >33 THEN 2060: REM DON'T PAINT IF SPOT IS IN CORNERS
2090 PLOT X,Y: NEXT
2100 REM PAINT START (GREEN) IN UPPER LEFT AND END (RED) IN LOWER RIGHT
2110 COLOR= 12: REM GREEN
2120 FOR X = 0 TO 2: FOR Y = 0 TO 2
2130 PLOT X,Y: NEXT : NEXT
2140 COLOR= 1: REM RED (ACTUALLY, MAGENTA)
2150 FOR X = 37 TO 39: FOR Y = 37 TO 39
2160 PLOT X,Y: NEXT : NEXT
2165 COLOR= 15: PLOT 3,3: REM DRAW WHITE MAN AT START POSITION
2168 IF GUARANTEE THEN GOSUB 2200: REM ASSURE A SOLUTION
2170 REM PRINT INSTRUCTIONS REMINDER
2175 IF SEE THEN POKE -16300,1: POKE -16301,0: REM SEE MAZE
2180 VTAB 21: PRINT "USE I-J-K-M DIAMOND TO MOVE YOUR WHITE"
2190 PRINT "MAN FROM START (GREEN) TO END (RED)"
2195 PRINT "WITHOUT HITTING THE MAZE WALLS!"
2197 PRINT "TYPE ANY KEY TO CONTINUE. ";: GET X$
2198 POKE -16368,0: HOME : VTAB 21: REM CLEAR KEYBOARD AND SCREEN
2199 GOTO 300
2200 REM ASSURE MAZE HAS A SOLUTION
2205 X = 3:Y = 3
2208 COLOR= 0
2210 T = INT( RND(1) *6 +1)
2220 ON T GOSUB 2300,2300,2310,2320,2320,2330
2230 IF SCRN( X,Y) = 1 THEN X = 3:Y = 3: COLOR= 15: GOTO 2800
2250 GOTO 2210
2300 FOR M = 1 TO 3
2302 X = X +1
2304 IF X >39 THEN X = 39
2305 IF SCRN( X,Y) = 1 THEN 2230
2306 PLOT X,Y: NEXT : RETURN
2310 FOR M = 1 TO 2
2312 X = X -1
2314 IF X <0 THEN X = 0
2315 IF SCRN( X,Y) = 1 THEN 2230
2316 PLOT X,Y: NEXT : RETURN
2320 FOR M = 1 TO 3
2322 Y = Y +1
2324 IF Y >39 THEN Y = 39
2325 IF SCRN( X,Y) = 1 THEN 2230
2326 PLOT X,Y: NEXT : RETURN
2330 FOR M = 1 TO 2
2332 Y = Y -1
2334 IF Y <0 THEN Y = 0
2335 IF SCRN( X,Y) = 1 THEN 2230
2336 PLOT X,Y: NEXT : RETURN
2800 GOTO 2170
3000 REM THE GAME ITSELF
3010 UP = 73:DOWN = 77:LEFT = 74:RIGHT = 75: REM ASCII CODES FOR I-J-K-M
3020 X = 3:Y = 3: REM START POSITION
3200 REM MOVE MAN
3210 Z = PEEK( -16384): REM READ KEYBOARDS
3211 IF Z >127 THEN Z = Z -128: REM CONVERT UPPER CASE FOR MACHINES WITH ADAPTERS
3212 POKE -16368,0: REM CLEAR KEYBOARD
3213 POKE -16384,0
3214 IF Z = 73 OR Z = 74 OR Z = 75 OR Z = 77 THEN 3225
3216 VTAB 22: HTAB 1
3218 TIME = TIME +1
3220 PRINT "TIME = "TIME;
3221 FOR PAUSE = 1 TO 100: NEXT
3222 GOTO 3200
3225 REM MOVE BY CHANGING X AND Y COORDINATES OF THE WHITE MAN
3228 XOLD = X:YOLD = Y: REM SAVE OLD X AND Y
3229 GOSUB 3700: REM ERASE OLD MAN
3230 IF Z = LEFT THEN X = X -1: IF X <0 THEN X = 0
3240 IF Z = RIGHT THEN X = X +1: IF X >39 THEN X = 39
3250 IF Z = UP THEN Y = Y -1: IF Y <0 THEN Y = 0
3260 IF Z = DOWN THEN Y = Y +1: IF Y >39 THEN Y = 39
3270 GOSUB 3800: REM CHECK TO SEE IF MAZE WALL CRASHED INTO
3280 GOSUB 3850: REM SEE IF GOAL REACHED
3285 IF WIN = 1 THEN IF HISCRE <SCRE THEN HISCRE = SCRE
3290 IF WIN = 1 THEN VTAB 24: PRINT "HIGH SCORE = "HISCRE;: HTAB 26: PRINT "ANOTHER GAME? ";: GET ANS$
3292 IF WIN = 1 AND ANS$ = "Y" THEN HOME : GOTO 74
3294 IF WIN = 1 THEN TEXT : HOME : VTAB 2: PRINT "BYE!": PRINT : END
3300 PLOT X,Y
3400 FOR PAUSE = 1 TO 200: NEXT
3425 TIME = TIME +1
3440 BUMPS = TALLY -1
3445 SCRE = INT(1000000/(TIME *TALLY))
3450 VTAB 22: HTAB 1: PRINT "TIME ="TIME;: HTAB 16: PRINT "BUMPS = "BUMPS;: HTAB 27: PRINT "SCORE = "SCRE;: CALL -868: REM CLEAR LINE TO RIGHT
3500 GOTO 3200
3700 COLOR= 0: REM BLACK
3710 PLOT X,Y
3720 COLOR= 15: RETURN
3800 REM CHECK FOR MAZE WALL CRASH
3810 IF SCRN( X,Y) = 13 THEN TALLY = TALLY +1: GOSUB 3900:X = XOLD:Y = YOLD: REM PENALTY, SOUND BUZZER, RESET X,Y
3820 RETURN
3850 REM SEE IF GOAL REACHED
3860 IF SCRN( X,Y) = 1 THEN VTAB 23: HTAB 14: INVERSE : PRINT "YOU DID IT!": NORMAL :WIN = 1
3870 RETURN
3900 REM BUZZER
3910 FOR I = 1 TO 5
3920 S = PEEK( -16336): REM THE SPEAKER
3930 NEXT : RETURN